package ch.zbw.rre.sortieren;

public class BubbleSort implements Isorter{

	private int[] feld;
	
	public BubbleSort() {
		this.feld = null;
	}
	

	@Override
	public void sort(int[] zahlen) {

		this.feld = zahlen;
		for (int i = (this.feld.length -1); i >= 1; i--){
			for(int j = 1; j <= i; j++){
				if(this.feld[j] < this.feld[j-1]){
					int tempFeldJ = this.feld[j];
					int tempFeldJM1 = this.feld[j-1];
					this.feld[j] = tempFeldJM1;
					this.feld[j-1] = tempFeldJ;
				}
			}
		}
		
	}

}
